package cn.myjerry.net.ip;

import java.net.InetAddress;
import java.net.UnknownHostException;
/**
 * 没有封装端口
 * @author Jerry
 *
 */
public class InetDemo01 {
	public static void main(String[] args) throws UnknownHostException {
		InetAddress addr = InetAddress.getLocalHost();
		System.out.println(addr.getHostAddress());
		System.out.println(addr.getHostName());

		addr = InetAddress.getByName("www.myjerry.cn");
		System.out.println(addr.getHostAddress());
		System.out.println(addr.getHostName());
		
		addr = InetAddress.getByName("211.149.199.109");
		System.out.println(addr.getHostAddress());
		System.out.println(addr.getHostName());
	}
}
